perm filename ALPHA4.LST[PAR,SYS] blob
sn#551600 filedate 1980-12-16 generic text, type T, neo UTF8
MICRO-SYMBOL 16-DEC-1980 ALPHA4 PAGE 1
COMMENT ⊗ VALID 00021 PAGES
C REC PAGE DESCRIPTION
C00001 00001
C00004 00002 →→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→ ALPHATEX 400 ←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←
C00008 00003 Interrupt jump table (when on-line)
C00013 00004 Floppy disk operations:
C00018 00005 Other operations available before going on-line:
C00030 00006 Primitive debugging routines that might be helpful in emergencies:
C00038 00007 Beginning of instructions for on-line processing (non-overlaid area):
C00041 00008 Main scanning routine, returns the next byte of input in register A:
C00044 00009 A program that prepares to typeset a character.
C00047 00010 The main scanning loop, beginning a new instruction:
C00052 00011 Program to set a specified beam brightness.
C00055 00012 Programs for simple adjustment commands.
C00057 00013 Interrupt handling for data received from computer or operator.
C00064 00014 Lens motor control routines:
C00074 00015 Feed motor control routines:
C00084 00016 Programs for beginning and ending the typesetting of a line or page.
C00093 00017 Processing of scan-done interrupts:
C00105 00018 Handy general-purpose subroutines:
C00109 00019 Constants and special tables.
C00114 00020 Program variables:
C00124 00021 The second memory board (locations 8000H and higher):
C00136 ENDMK
C⊗;
MICRO-SYMBOL 16-DEC-1980 ALPHA4 PAGE 2
;→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→ ALPHATEX 400 ←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←
; this is the alphatex that runs on CRS Alphatype 400 series machines
; to compile it, r micros<return> alpha4,alpha4←alpha4(8080)
;
; Symbolic names of I/O ports:
00C8 LTIMR EQU 0C8H; lens motor timer.
00CA GTIMR EQU 0CAH; general-purpose timer.
00D0 FTIMR EQU 0D0H; feed motor timer.
00C0 INT EQU 0C0H; interrupt controller.
00DD DISPL EQU 0DDH; console display, keyboard input, motor switch sensors.
00DA BTLCH EQU 0DAH; "boot latch".
00DB MSLCH EQU 0DBH; "machine status latch".
0088 BRT1 EQU 088H; brightness control 1.
00A0 BRT2 EQU 0A0H; brightness control 2.
0098 BEAMR EQU 098H; beam position reset.
00DF BSTEP EQU 0DFH; beam step.
00D2 DMA EQU 0D2H; direct memory access, RAM to collector board.
00DE COLL EQU 0DEH; start collection.
00DF RPLCH EQU 0DFH; hardware cog counter and repeat latch.
0080 RS232 EQU 080H; on-line data interface.
00B8 RATE EQU 0B8H; repeat counter for baud rate setting.
; The following addresses refer to subroutines in the boot PROM:
0229 BTAD EQU 0229H; binary to ascii decimal.
01FD DC EQU 01FDH; display a character.
01EF DCS EQU 01EFH; display a character string.
00F8 ERROR EQU 00F8H; fatal error.
0156 KBIS EQU 0156H; keyboard interrupt service.
00FF NFE EQU 00FFH; non-fatal error.
01D8 SMD EQU 01D8H; single message display.
; Note: The ORG instruction preceding "ABRT:" on page 7 needs to be adjusted
; if code is added to the non-overlaid parts of this program.
; Furthermore, please excuse a trick that saves two (2) bytes:
; The least significant byte of location "TABLE" should not be 0 or 1.
MICRO-SYMBOL 16-DEC-1980 ALPHA4 PAGE 3
; Interrupt jump table (when on-line)
2000 ORG 2000H
;
2000 FB EI ; interrupt 0, 00000001
2001 C36477 JMP LMIS; lens motor.
;
2004 FB EI ; interrupt 1, 00000010
2005 C3927B JMP SDIS; scan done.
;
2008 FB EI ; interrupt 2, 00000100
2009 C35B76 JMP RRIS; on-line data ready.
;
200C FB EI ; interrupt 3, 00001000
200D C38178 JMP FMIS; feed motor.
;
2010 FB EI ; interrupt 4, 00010000
2011 C3DB79 JMP GPTIS; general purpose timer.
;
2014 FB EI ; interrupt 5, 00100000
2015 C33777 JMP KBIS1; keyboard.
;
2018 FB EI ; interrupt 6, 01000000
2019 C37076 JMP RDIS; on-line data.
;
; ei
; jmp rtis
201C CDF800 CALL ERROR; interrupt 7, 10000000
201F 00 NOP ; not used.
2020 REP1: ; First repertoire area, overlays the following.
; (Bootstrap PROM jumps here after loading the low seg.)
4020 ORG 4020H
4020 C32640 JMP BOOT
4023 C34140 NOBOOT: JMP START; The loader at BF00 always jumps here (must be 4023).
4026 210545 BOOT: LXI H,READHI; Check high segment
4029 CD2A41 CALL DSKCOM
402C CA4140 JZ START; hiseg loaded, let her rip
402F 11D143 LXI D,DM0; 'CAN'T LOAD HI SEGMENT'.
4032 CDFF00 CALL NFE
4035 0E1E MVI C,30; Delay about 30 seconds
4037 21204E BOOT0: LXI H,20000
403A CDFE7D CALL DELAY
403D 0D DCR C
403E C23740 JNZ BOOT0
4041 3E16 START: MVI A,16H; Move interrupt jump table to 6000H.
4043 D3C0 OUT INT
4045 3E60 MVI A,60H
4047 D3C1 OUT INT+1
4049 3EDF MVI A,11011111B; (Keyboard is the 0 in bit 5.)
404B D3C1 OUT INT+1; Enable keyboard interrupt (only).
MICRO-SYMBOL 16-DEC-1980 ALPHA4 PAGE 3-2
404D 110344 PRMPT: LXI D,DM2; Display 'ALPHATEX ... COMMAND?'.
4050 CDEF01 CALL DCS
4053 97 WAIT: SUB A; Reset keyboard buffer.
4054 21C47F LXI H,KBLC
4057 77 MOV M,A
4058 B6 WAIT1: ORA M
4059 CA5840 JZ WAIT1; Wait until command code is typed.
405C 3ACB7F SWICH: LDA KBIB
405F 87 ADD A; A = (Key)*(switch table record length).
4060 1600 MVI D,0
4062 5F MOV E,A; DE = 00XX.
4063 216C40 LXI H,SWT; Compute switch table address.
4066 19 DAD D
4067 5E MOV E,M; Fetch branch address from table.
4068 23 INX H
4069 56 MOV D,M
406A EB XCHG ; Put branch address in HL.
406B E9 PCHL ; Branch to routine.
406C 4D40 SWT: DW PRMPT; 0, no op.
406E 4D40 DW PRMPT; 1, no op.
4070 4D40 DW PRMPT; 2, no op.
4072 4D40 DW PRMPT; 3, no op.
4074 4D40 DW PRMPT; 4, no op.
4076 4D40 DW PRMPT; 5, no op.
4078 DB42 DW ONLIN; 6, go on line.
407A 0A43 DW SETBR; 7, set baud rate of RS232 communication
407C 4D40 DW PRMPT; 8, copy font (not yet implemented).
407E C740 DW INITD; 9, initialize diskette.
4080 8741 DW SERCH; A, address search.
4082 FA40 DW DUMP; B, backup dump of program.
4084 2142 DW MODFY; C, change and contemplate memory contents.
4086 8045 DW UNTR; D, dump trace information to host computer.
4088 4741 DW LOAD; E, enter HEX file from host computer.
408A A442 DW FLASH; F, light show.
408C DBC0 QUIT: IN INT
408E 322060 STA INTSV; Store interrupt status for inspection.
4091 3A157F LDA BTLS
4094 E6F7 ANI 11110111B
4096 D3DA OUT BTLCH; Disable output GO.
4098 3E40 MVI A,40H
409A D3CB OUT LTIMR+3
409C DBC9 IN LTIMR+1
409E 6F MOV L,A
409F DBC9 IN LTIMR+1
40A1 67 MOV H,A
40A2 222460 SHLD INTCL; Store clock reading.
40A5 3E34 MVI A,34H
MICRO-SYMBOL 16-DEC-1980 ALPHA4 PAGE 3-3
40A7 D3CB OUT LTIMR+3
40A9 3E70 MVI A,70H
40AB D3CB OUT LTIMR+3; Attempt to stop lens motor.
40AD 210000 LXI H,0
40B0 39 DAD SP
40B1 222260 SHLD INTSP; Store the stack height.
40B4 C34140 JMP START
; A few routines left out of the 400-Series Boot PROM
; (Note that they're in the overlaid area--if you want to use them
; from non-overlaid code you'll have to move them.)
40B7 CDBD40 CAC: CALL CDTAC
40BA 77 MOV M,A
40BB 23 INX H
40BC C9 RET
40BD E60F CDTAC: ANI 0FH
40BF C630 ADI '0'
40C1 FE3A CPI '9'+1
40C3 D8 RC
40C4 C607 ADI 'A'-'9'-1
40C6 C9 RET
MICRO-SYMBOL 16-DEC-1980 ALPHA4 PAGE 4
; Floppy disk operations:
40C7 112944 INITD: LXI D,DM3; Display 'INITIALIZING...'.
40CA CDD801 CALL SMD
40CD 21DD44 LXI H,NEWDSK; Initialize first track.
40D0 CD2A41 CALL DSKCOM
40D3 C2F140 JNZ INIT3; Jump if error.
40D6 3E1A INIT1: MVI A,26; Next track.
40D8 32FF7F STA NSCT; 26 sectors,
40DB 3E01 MVI A,1
40DD 32FC7F STA SECTR; beginning with sector 1.
40E0 CD3841 CALL DSKGO
40E3 C2F140 JNZ INIT3
40E6 3AFB7F LDA TRACK
40E9 FE4D CPI 77
40EB C2D640 JNZ INIT1; Repeat until track 77 reached.
40EE C34D40 JMP PRMPT; Return to control routine.
40F1 INIT3:
40F1 113944 DUMP3: LXI D,DM4; 'CANNOT WRITE ON DISK 1'.
40F4 CDFF00 DUMP4: CALL NFE
40F7 C34D40 JMP PRMPT
40FA 114F44 DUMP: LXI D,DM5; Display 'BACKUP COPY BEING DUMPED...'.
40FD CDD801 CALL SMD
4100 21E544 LXI H,WRTLOW; Write low segment of memory
4103 CD2A41 CALL DSKCOM
4106 C2F140 JNZ DUMP3
4109 21F544 LXI H,WRTHI; Write high segment of memory
410C CD2A41 CALL DSKCOM
410F C2F140 JNZ DUMP3
4112 21ED44 LXI H,CHKLOW; Check low segment
4115 CD2A41 CALL DSKCOM
4118 C22441 JNZ DUMP2; error in low segment
411B 21FD44 LXI H,CHKHI; Check high segment
411E CD2A41 CALL DSKCOM
4121 CA4D40 JZ PRMPT; Return to control routine.
4124 116B44 DUMP2: LXI D,DM6; 'COULDN'T READ WHAT WAS DUMPED'.
4127 C3F440 JMP DUMP4
; Subroutine DSKCOM does disk I/O; arguments are in block pointed to by HL.
412A 7E DSKCOM: MOV A,M; Select sector format.
412B 32EE7F STA VARSE
412E 23 INX H
MICRO-SYMBOL 16-DEC-1980 ALPHA4 PAGE 4-2
412F 010600 LXI B,6; Move 6 bytes to COMWD.
4132 11F97F LXI D,COMWD
4135 CDE87D CALL MOVE
4138 3E08 DSKGO: MVI A,8; Start disk command.
413A 32F87F STA OKWD
413D 3AF87F DSKWT: LDA OKWD; Wait for OKWD to change (disk command finished).
4140 FE08 CPI 8
4142 CA3D41 JZ DSKWT
4145 B7 ORA A; Report success or failure.
4146 C9 RET
MICRO-SYMBOL 16-DEC-1980 ALPHA4 PAGE 5
; Other operations available before going on-line:
4147 3A00BF LOAD: LDA LOADR
414A FECD CPI 0CDH; Check if load routine seems intact.
414C C24D40 JNZ PRMPT; If not, this routine is disabled.
414F 3EFF MVI A,11111111B
4151 D3C1 OUT INT+1; All interrupts are disabled.
4153 CD3643 CALL RSINI
4156 11AD44 LXI D,DM10; Display 'READY TO LOAD A HEX FILE:'.
4159 CDD801 CALL SMD
415C C300BF JMP LOADR
415F 7D CHB: MOV A,L; Subroutine to convert hex codes to one byte:
4160 07 RLC ; (If HL = 0X 0Y hex, then A = YX hex.)
4161 07 RLC
4162 07 RLC
4163 07 RLC
4164 B4 ORA H
4165 C9 RET
4166 97 RDKC: SUB A; Subroutine to read and display B keyboard codes:
4167 32C47F STA KBLC; Clear keyboard buffer.
416A 21C47F RDKC1: LXI H,KBLC; Look at input buffer count.
416D 7E MOV A,M
416E BE RDKC2: CMP M
416F CA6E41 JZ RDKC2; Wait until code entered (KBLC changes).
4172 5F MOV E,A
4173 1600 MVI D,0; DE=count.
4175 21CB7F LXI H,KBIB
4178 19 DAD D
4179 7E MOV A,M; Get keyboard code.
417A C5 PUSH B
417B CDBD40 CALL CDTAC; Convert hexadecimal to ascii.
417E CDFD01 CALL DC; Display the character.
4181 C1 POP B
4182 05 DCR B
4183 C26A41 JNZ RDKC1; Repeat.
4186 C9 RET
4187 2AFEBF SERCH: LHLD 0BFFEH
418A E5 PUSH H; Save top two bytes of memory.
418B 118944 LXI D,DM7; Display 'ADDRESS '.
418E CDD801 CALL SMD
4191 0604 MVI B,4
4193 CD6641 CALL RDKC; Read and display four keyboard codes.
MICRO-SYMBOL 16-DEC-1980 ALPHA4 PAGE 5-2
4196 2ACB7F LHLD KBIB; Convert them to binary.
4199 CD5F41 CALL CHB
419C 57 MOV D,A
419D 32FFBF STA 0BFFFH; Store at top end of memory.
41A0 2ACD7F LHLD KBIB+2
41A3 CD5F41 CALL CHB
41A6 5F MOV E,A
41A7 32FEBF STA 0BFFEH
41AA 210020 LXI H,2000H; Begin search at 2000H.
41AD 7E SRCH1: MOV A,M
41AE BB SRCH2: CMP E
41AF 23 INX H
41B0 C2AD41 JNZ SRCH1
41B3 7E MOV A,M
41B4 BA CMP D
41B5 C2AE41 JNZ SRCH2
41B8 2B DCX H; We found one in location HL.
41B9 7C MOV A,H
41BA FEBF CPI 0BFH
41BC C2C641 JNZ SRCH3
41BF 7D MOV A,L
41C0 FEFE CPI 0FEH
41C2 CA1642 JZ SRCH9; Exit if it was the top location (we knew about that).
41C5 7C MOV A,H
41C6 221F42 SRCH3: SHLD SLOC
41C9 EB XCHG
41CA 221D42 SHLD SLOOK
41CD 21C944 LXI H,DM11+2
41D0 0F RRC
41D1 0F RRC
41D2 0F RRC
41D3 0F RRC
41D4 CDB740 CALL CAC; Convert left four bits to ascii, storing in DM11.
41D7 3A2042 LDA SLOC+1
41DA CDB740 CALL CAC; Convert right four bits to ascii.
41DD 3A1F42 LDA SLOC
41E0 47 MOV B,A
41E1 0F RRC
41E2 0F RRC
41E3 0F RRC
41E4 0F RRC
41E5 CDB740 CALL CAC; And again, four+four bits to ascii.
41E8 78 MOV A,B
41E9 CDB740 CALL CAC
41EC 11C744 LXI D,DM11
41EF CDEF01 CALL DCS; Display where we found it.
MICRO-SYMBOL 16-DEC-1980 ALPHA4 PAGE 5-3
41F2 97 SUB A
41F3 32C47F STA KBLC
41F6 21C47F LXI H,KBLC
41F9 BE SRCH4: CMP M
41FA CAF941 JZ SRCH4; Wait until user tingles the keyboard.
41FD 3ACB7F LDA KBIB
4200 FE0A CPI 0AH
4202 C21642 JNZ SRCH9; Exit if not 'A'.
4205 2A1D42 LHLD SLOOK
4208 EB XCHG
4209 210000 LXI H,0
420C 221D42 SHLD SLOOK
420F 2A1F42 LHLD SLOC
4212 23 INX H
4213 C3AD41 JMP SRCH1; Otherwise continue the search.
4216 E1 SRCH9: POP H
4217 22FEBF SHLD 0BFFEH; Restore top two bytes.
421A C34D40 JMP PRMPT
421D 0000 SLOOK: DW 0; What we're seeking.
421F 0000 SLOC: DW 0; Where we found it.
4221 118944 MODFY: LXI D,DM7; Display 'ADDRESS '.
4224 CDD801 CALL SMD
4227 0604 MVI B,4
4229 CD6641 CALL RDKC; Read and display four keyboard codes.
422C 2ACB7F LHLD KBIB; Convert them to binary.
422F CD5F41 CALL CHB
4232 57 MOV D,A
4233 2ACD7F LHLD KBIB+2
4236 CD5F41 CALL CHB
4239 5F MOV E,A
423A 7A MM1: MOV A,D; Check if address is in range.
423B FE20 CPI 20H
423D DA9E42 JC MM3
4240 FEC0 CPI 0C0H
4242 D29E42 JNC MM3
4245 D5 PUSH D; Save address.
4246 EB XCHG
4247 46 MOV B,M; Current byte value to B.
4248 219444 LXI H,DM8+2; Convert "XX" to ASCII(A).
424B 78 MOV A,B
MICRO-SYMBOL 16-DEC-1980 ALPHA4 PAGE 5-4
424C 0F RRC
424D 0F RRC
424E 0F RRC
424F 0F RRC
4250 CDB740 CALL CAC; Convert left four bits to ascii.
4253 78 MOV A,B
4254 CDB740 CALL CAC; Convert right four bits to ascii.
4257 119244 LXI D,DM8
425A CDEF01 CALL DCS; Display ' xx->'.
425D 0602 MVI B,2
425F CD6641 CALL RDKC; Read and display two keyboard codes.
4262 3AC47F MM2: LDA KBLC; Read the next code.
4265 FE03 CPI 3
4267 DA6242 JC MM2
426A D1 POP D; Get modify address back.
426B 3ACD7F LDA KBIB+2
426E FE0B CPI 0BH
4270 CA3A42 JZ MM1; Back to same byte, unmodified, if "B".
4273 FE0C CPI 0CH
4275 CA2142 JZ MODFY; Call for new address, no change here, if "C".
4278 FE0D CPI 0DH
427A CA9A42 JZ DNWRD; Decrement to previous byte, no modification, if "D".
427D FE0E CPI 0EH
427F CA4D40 JZ PRMPT; Exit, no modification, if "E".
4282 FE0F CPI 0FH
4284 CA9642 JZ ONWRD; Forward to next byte, no modification, if "F".
4287 2ACB7F LHLD KBIB; Fetch codes typed for this byte.
428A CD5F41 CALL CHB; Convert them to binary.
428D 12 STAX D; Store the new byte.
428E 3ACD7F LDA KBIB+2
4291 FE0A CPI 0AH; Advance, modified, if "A".
4293 C24D40 JNZ PRMPT; Otherwise go home, modification accepted.
4296 13 ONWRD: INX D
4297 C33A42 JMP MM1; Go on to next word.
429A 1B DNWRD: DCX D
429B C33A42 JMP MM1; Go down to previous word.
429E 119844 MM3: LXI D,DM9; 'ADDRESS OUT OF RANGE'.
42A1 C3F440 JMP DUMP4
42A4 97 FLASH: SUB A
42A5 32C47F STA KBLC; Clear keyboard buffer.
42A8 06F7 MVI B,11110111B; B←one bit of light.
42AA 68 MOV L,B; Ensure that HL ≠ 00.
MICRO-SYMBOL 16-DEC-1980 ALPHA4 PAGE 5-5
42AB 1111A0 FL1: LXI D,0A011H; DE←primitive polynomial.
42AE 29 DAD H; Advance the shift register sequence (period is 65535).
42AF 78 MOV A,B
42B0 D2BC42 JNC FL2
42B3 19 DAD D
42B4 0F RRC
42B5 DAC242 JC FL3
42B8 0F RRC ; Seven-bit rotation, moves the bit down.
42B9 C3C242 JMP FL3
42BC 07 FL2: RLC
42BD B7 ORA A
42BE FAC242 JM FL3
42C1 07 RLC ; Seven-bit rotation, moves the bit up.
42C2 47 FL3: MOV B,A
42C3 E67F ANI 01111111B
42C5 EE00 XRI 00000000B
42C7 D3DD OUT DISPL; Display the new column.
42C9 3AC47F LDA KBLC
42CC B7 ORA A
42CD C25C40 JNZ SWICH; Return to control after the next typein.
42D0 EB XCHG
42D1 21C801 LXI H,200+256
42D4 CDFE7D CALL DELAY; Delay about 10 milliseconds.
42D7 EB XCHG
42D8 C3AB42 JMP FL1; Repeat.
42DB 31C27F ONLIN: LXI SP,ISPV; We want to start with a fresh stack.
42DE 3E16 MVI A,16H
42E0 D3C0 OUT INT
42E2 3E20 MVI A,20H
42E4 D3C1 OUT INT+1; Move the interrupt jump table to 2000H.
42E6 3E80 MVI A,10000000B
42E8 D3C1 OUT INT+1; Enable all seven interrupts.
42EA 3E0B MVI A,00001011B
42EC D3C0 OUT INT; Prepare to read interrupt status register.
42EE CD3643 CALL RSINI
42F1 3AEA7E LDA MSLSI
42F4 D3DB OUT MSLCH
42F6 3AEB7E LDA BTLSI
42F9 D3DA OUT BTLCH
42FB 11CD44 LXI D,DM14; Display `ON LINE: '.
42FE CDD801 CALL SMD
4301 210085 LXI H,8500H
MICRO-SYMBOL 16-DEC-1980 ALPHA4 PAGE 5-6
4304 220D45 SHLD TRACL; Initialize for tracing.
4307 C39A73 JMP REST2; Start (or restart) the typesetting program.
430A 3A9A43 SETBR: LDA BAUD;
430D 6F MOV L,A;
430E 97 SUB A
430F 67 MOV H,A
4310 29 DAD H
4311 23 INX H
4312 29 DAD H; hl←4*buad+2
4313 119B43 LXI D,RS0
4316 19 DAD D
4317 5E MOV E,M
4318 23 INX H
4319 56 MOV D,M; de←contents of (rs0+4*baud+2)
431A CDD801 CALL SMD; which is the address of the baud rate char string
431D 11D744 LXI D,DM15
4320 CDEF01 CALL DCS
4323 0601 MVI B,1
4325 CD6641 CALL RDKC
4328 3ACB7F LDA KBIB
432B FE06 CPI 6; 0 thru 5 are legal baud rate codes
432D D24D40 JNC PRMPT; Leave when illegal rate entered
4330 329A43 STA BAUD; Otherwise, save new rate, and report it
4333 C30A43 JMP SETBR; by looping back around
4336 E5 RSINI: PUSH H; Initialize the USART
4337 D5 PUSH D
4338 3A9A43 rsini0: LDA BAUD;
433B 6F MOV L,A;
433C 97 SUB A
433D 67 MOV H,A
433E 29 DAD H
433F 29 DAD H
4340 119B43 LXI D,RS0
4343 19 DAD D; hl←rs0+4*baud
4344 7E MOV A,M
4345 D3B8 OUT RATE; Tell the clock generator its divisor
4347 23 INX H
4348 E5 push h
4349 1603 mvi d,3
434B 3E00 rsini1: MVI A,00000000B; Force USART chip into command state.
434D D381 OUT RS232+1
434F CDFB7D CALL DELAY2
4352 15 dcr d
4353 C24B43 jnz rsini1
4356 3E40 MVI A,01000000B; Reset USART chip.
4358 D381 OUT RS232+1
435A CDFB7D CALL DELAY2
MICRO-SYMBOL 16-DEC-1980 ALPHA4 PAGE 5-7
435D E1 pop h
435E 3A9943 lda rstat
4361 F64C ORI 01001100B; Tell USART the 'divide-by' number
4363 D381 OUT RS232+1
4365 CDFB7D CALL DELAY2
4368 3E37 MVI A,00110111B; Enable USART for sending and receiving.
436A D381 OUT RS232+1;
436C CDFB7D CALL DELAY2
436F DB81 in rs232+1
4371 329943 sta rstat
4374 0F rrc
4375 0F rrc
4376 0F rrc
4377 0F rrc
4378 CDBD40 call cdtac
437B CDFD01 call dc
437E 3A9943 lda rstat
4381 CDBD40 call cdtac
4384 CDFD01 call dc
4387 3E20 mvi a,' '
4389 CDFD01 call dc
438C 3A9943 lda rstat
438F E605 ani 101B
4391 EE05 xri 101B
4393 C23843 jnz rsini0
4396 D1 POP D
4397 E1 POP H
4398 C9 RET
4399 00 rstat: db 0
439A 04 BAUD: DB 4; Default to 9600 Baud
439B 0803 RS0: DB 08H, 3
439D B343 DW RSM0
439F 0E03 RS1: DB 0EH, 3
43A1 B743 DW RSM1
43A3 0F03 RS2: DB 0FH, 3
43A5 BC43 DW RSM2
43A7 0E02 RS3: DB 0EH, 2
43A9 C143 DW RSM3
43AB 0F02 RS4: DB 0FH, 2
43AD C643 DW RSM4
43AF 0801 RS5: DB 08H, 1
43B1 CB43 DW RSM5
43B3 03333030 RSM0: DB 3,'300'
43B7 04313230
43BB 30 RSM1: DB 4,'1200'
43BC 04323430
43C0 30 RSM2: DB 4,'2400'
43C1 04343830
43C5 30 RSM3: DB 4,'4800'
43C6 04393630
MICRO-SYMBOL 16-DEC-1980 ALPHA4 PAGE 5-8
43CA 30 RSM4: DB 4,'9600'
43CB 05313932
43CF 3030 RSM5: DB 5,'19200'
; Table of display messages that are overlaid:
43D1 1743414E
43D5 27542052
43D9 45414420
43DD 48494748
43E1 20534547
43E5 4D454E54 DM0: DB 23,'CAN',27H,'T READ HIGH SEGMENT'
43E9 1944554D
43ED 50494E47
43F1 20544845
43F5 20545241
43F9 43452049
43FD 4E464F2E
4401 2E2E DM1: DB 25,'DUMPING THE TRACE INFO...'
4403 25414C50
4407 48415445
440B 58205345
440F 52564552
4413 20444543
4417 2E20322C
441B 31393830
441F 2E20434F
4423 4D4D414E
4427 443F DM2: DB 37,'ALPHATEX SERVER DEC. 2,1980. COMMAND?'
4429 0F494E49
442D 5449414C
4431 495A494E
4435 472E2E2E DM3: DB 15,'INITIALIZING...'
4439 1543414E
443D 27542057
4441 52495445
4445 204F4E20
4449 4449534B
444D 2031 DM4: DB 21,'CAN',27H,'T WRITE ON DISK 1'
444F 1B424143
4453 4B555020
4457 434F5059
445B 20424549
445F 4E472044
4463 554D5045
4467 442E2E2E DM5: DB 27,'BACKUP COPY BEING DUMPED...'
446B 1D434F55
446F 4C444E27
4473 54205245
4477 41442057
447B 48415420
MICRO-SYMBOL 16-DEC-1980 ALPHA4 PAGE 5-9
447F 57415320
4483 44554D50
4487 4544 DM6: DB 29,'COULDN',27H,'T READ WHAT WAS DUMPED'
4489 08414444
448D 52455353
4491 20 DM7: DB 8,'ADDRESS '
4492 05205858
4496 2D3E DM8: DB 5,' XX->'
4498 14414444
449C 52455353
44A0 204F5554
44A4 204F4620
44A8 52414E47
44AC 45 DM9: DB 20,'ADDRESS OUT OF RANGE'
44AD 19524541
44B1 44592054
44B5 4F204C4F
44B9 41442041
44BD 20484558
44C1 2046494C
44C5 453A DM10: DB 25,'READY TO LOAD A HEX FILE:'
44C7 05205858
44CB 5858 DM11: DB 5,' XXXX'
44CD 094F4E20
44D1 4C494E45
44D5 3A20 DM14: DB 9,'ON LINE: '
44D7 05204241
44DB 5544 DM15: DB 5,' BAUD'
; DISK CONTROLLER INTERFACE DATA
; SINCE THERE ARE 128 BYTES PER SECTOR AND 26 SECTORS PER TRACK:
; LOW SEG IS 2000H THRU 7F7FH = TRACK 0 SECTOR 1 THRU TRACK 7 SECTOR 9
; HI SEG IS 8000H THRU BFFFH = TRACK 7 SECTOR 11 THRU TRACK 12 SECTOR 8
; VARSE COMWD DISK TRACK SECTR ADDR NSCT
44DD 00060100
44E1 0100001A NEWDSK: DB 0, 6, 1, 0, 1, 00,00, 26
44E5 00020100
44E9 010020BF WRTLOW: DB 0, 2, 1, 0, 1, 00,20H, 191
44ED 00030100
44F1 010020BF CHKLOW: DB 0, 3, 1, 0, 1, 00,20H, 191
44F5 00020107
44F9 0B008080 WRTHI: DB 0, 2, 1, 7, 11, 00,80H, 128
44FD 00030107
4501 0B008080 CHKHI: DB 0, 3, 1, 7, 11, 00,80H, 128
4505 00010007
4509 0B008080 READHI: DB 0, 1, 0, 7, 11, 00,80H, 128
MICRO-SYMBOL 16-DEC-1980 ALPHA4 PAGE 6
; Primitive debugging routines that might be helpful in emergencies:
450D 0085 TRACL: DW 8500H; Area where next tracing info will be dumped.
450F 0085 UNTRL: DW 8500H; Location to begin output of tracing info.
; If "CALL TRACE" is inserted into the non-overlaid program,
; and if the "overlaid" sections of AlphaTEX are not in fact overlaid,
; this subroutine will store 16 bytes of potentially relevant information, to wit:
; xxx0 lsb of stack pointer
; xxx1 the interrupt service register
; xxx2 register C
; xxx3 register B
; xxx4 register E
; xxx5 register D
; xxx6 register L
; xxx7 register H
; xxx8 sign,zero,0,auxcarry,0,parity,1,carry bits
; xxx9 register A
; xxxA lsb of calling location
; xxxB msb of calling location
; xxxC top byte of stack
; xxxD 2nd byte of stack
; xxxE 3rd byte of stack
; xxxF 4th byte of stack
; Caution: It takes 897 cycles (448.5 microseconds) to CALL TRACE. This might
; interfere with the program timing, especially when servicing interrupts.
4511 F5 TRACE: PUSH PSW; First we fill the stack with stuff to dump.
4512 E5 PUSH H
4513 D5 TRAC2: PUSH D
4514 C5 PUSH B
4515 3EFF MVI A,11111111B
4517 D3C1 OUT INT+1; Disable all interrupts;
4519 21FEFF LXI H,-2
451C 39 DAD SP; H ← value of SP after the PUSH to follow.
451D 5D MOV E,L
451E DBC0 IN INT
4520 57 MOV D,A
4521 D5 PUSH D; This pushes lsb of stack pointer and the ISR byte.
4522 EB XCHG ; DE←stack pointer.
4523 2A0D45 LHLD TRACL
4526 0E10 MVI C,16
4528 1A TRAC1: LDAX D; Now we copy the top 16 bytes of the stack.
4529 77 MOV M,A
452A 13 INX D
MICRO-SYMBOL 16-DEC-1980 ALPHA4 PAGE 6-2
452B 23 INX H
452C 0D DCR C
452D C22845 JNZ TRAC1
4530 220D45 SHLD TRACL
4533 3E80 MVI A,10000000B
4535 D3C1 OUT INT+1; Unmask the interrupts.
4537 7C MOV A,H
4538 FEBC CPI 0BCH
453A D1 POP D; Restore registers.
453B C1 POP B
453C D1 POP D
453D CA4F45 JZ DEB3; Abort if the trace dump area is full.
4540 E1 TRAC3: POP H
4541 F1 POP PSW
4542 C9 RET
; If "CALL DEBUG" is inserted into the non-overlaid program,
; and if the "overlaid" sections of AlphaTEX are not in fact overlaid,
; this subroutine will do a TRACE and also generate an ABORT command
; that will take AlphaTEX off line again.
4543 3A157F DEB0: LDA BTLS; This entrance comes from a missed scan-done interrupt.
4546 E6F7 ANI 11110111B
4548 32157F STA BTLS
454B D3DA OUT BTLCH; Disable output GO.
454D F5 DEBUG: PUSH PSW; Store registers, in preparation for TRACE.
454E E5 PUSH H
454F 3E0F DEB3: MVI A,00001111B
4551 320D7F STA QFLAG; Abort prepared.
4554 2A7A45 LHLD DEB1
4557 229A73 SHLD REST2; CODE MODIFICATION!!!
455A 3A7C45 LDA DEB1+2
455D 329C73 STA REST2+2; Store a JMP DEB2 at RESET handler.
4560 3A0E45 LDA TRACL+1; Look at msb of TRACL.
4563 FEBC CPI 0BCH
4565 C21345 JNZ TRAC2; Trace, unless trace dump area is full.
4568 C37273 JMP ABRT1; Otherwise abort.
456B 2A7D45 DEB2: LHLD REST2T
456E 229A73 SHLD REST2; Restore location REST2 to normal contents.
4571 3A7F45 LDA REST2T+2
4574 329C73 STA REST2+2
4577 C34140 JMP START; Restart off-line command processing.
457A C36B45 DEB1: JMP DEB2; Command stored temporarily in location REST2.
MICRO-SYMBOL 16-DEC-1980 ALPHA4 PAGE 6-3
457D 011700 REST2T: LXI B,INITE-INITB; Normal contents of location REST2.
; The following routine sends the traced data back to a host computer file
; so that it can be studied at leisure.
4580 11E943 UNTR: LXI D,DM1; Display 'DUMPING TRACE INFO...'.
4583 CDD801 CALL SMD
4586 97 SUB A
4587 32C47F STA KBLC
458A 2A0D45 LHLD TRACL
458D EB XCHG ; DE ← end of tracing info.
458E 2A0F45 LHLD UNTRL; HL ← start of tracing info.
4591 7D UNTR1: MOV A,L
4592 E60F ANI 1111B
4594 C2BA45 JNZ UNTR2; Jump if not multiple of 16.
4597 3AC47F LDA KBLC
459A B7 ORA A
459B C2C545 JNZ UNTR5; Jump if user interrupts.
459E 3E0D MVI A,0DH; carriage-return
45A0 CDE345 CALL SENDC
45A3 3E0A MVI A,0AH; line-feed
45A5 CDE345 CALL SENDC
45A8 7A MOV A,D
45A9 BC CMP H
45AA C2B245 JNZ UNTR3; Jump if not done.
45AD 7B MOV A,E
45AE BD CMP L
45AF CAC245 JZ UNTR4; Jump if done.
45B2 7D UNTR3: MOV A,L; Send the current location.
45B3 CDCB45 CALL SENDB
45B6 7C MOV A,H
45B7 CDCB45 CALL SENDB
45BA 7E UNTR2: MOV A,M
45BB CDCB45 CALL SENDB
45BE 23 INX H
45BF C39145 JMP UNTR1
45C2 210085 UNTR4: LXI H,8500H
45C5 220F45 UNTR5: SHLD UNTRL
45C8 C34D40 JMP PRMPT
45CB F5 SENDB: PUSH PSW; This subroutine outputs a byte in hexadecimal form.
45CC 0F RRC
45CD 0F RRC
45CE 0F RRC
MICRO-SYMBOL 16-DEC-1980 ALPHA4 PAGE 6-4
45CF 0F RRC
45D0 CDBD40 CALL CDTAC; Convert left four bits to ascii.
45D3 CDE345 CALL SENDC
45D6 F1 POP PSW
45D7 CDBD40 CALL CDTAC; Convert right four bits to ascii.
45DA CDE345 CALL SENDC
45DD 3E20 MVI A,' '
45DF CDE345 CALL SENDC
45E2 C9 RET
45E3 E5 SENDC: PUSH H; Outputs a character to the host.
45E4 21C801 LXI H,200+256; Delay about 10 milliseconds.
45E7 CDFE7D CALL DELAY
45EA E1 POP H
45EB D380 OUT RS232; Send the character.
45ED C9 RET
; Temporary interrupt jump table (later overlaid):
6000 ORG 6000H
6000 CDF800 CALL ERROR; interrupt 0,
6003 00 NOP ; not used.
6004 CDF800 CALL ERROR; interrupt 1,
6007 00 NOP ; not used.
6008 CDF800 CALL ERROR; interrupt 2,
600B 00 NOP ; not used.
600C CDF800 CALL ERROR; interrupt 3,
600F 00 NOP ; not used.
6010 CDF800 CALL ERROR; interrupt 4,
6013 00 NOP ; not used.
6014 FB EI ; interrupt 5,
6015 C35601 JMP KBIS; keyboard.
6018 CDF800 CALL ERROR; interrupt 6,
601B 00 NOP ; not used.
601C CDF800 CALL ERROR; interrupt 7,
601F 00 NOP ; not used.
6020 00 INTSV: DB 0; interrupt status byte saved by QUIT.
6021 01 INTTP: DB 1; type of jump to QUIT.
6022 0000 INTSP: DW 0; stack pointer saved by QUIT.
6024 0000 INTCL: DW 0; clock reading saved by QUIT.
MICRO-SYMBOL 16-DEC-1980 ALPHA4 PAGE 7
; Beginning of instructions for on-line processing (non-overlaid area):
7370 ORG 7370H; This address to be adjusted so that page 20 comes out right.
7370 D380 ABRT: OUT RS232; (Control reaches here from GET subroutine.)
7372 11C57E ABRT1: LXI D,ABORT
7375 CDEF01 CALL DCS; Display " ABORTING"
7378 D1 POP D; Do not return from GET.
7379 0E0F RESET: MVI C,15; Delay about 15 seconds, to make sure that interrupts cease.
737B 21204E REST0: LXI H,20000
737E CDFE7D CALL DELAY
7381 0D DCR C
7382 C27B73 JNZ REST0
7385 3A047F lda kbib1
7388 FE01 cpi 1
738A C29473 jnz rest1; Jump if not "B".
738D 3E16 mvi a,16h; Reset interrupt chip
738F D3C0 out int
7391 C30000 jmp 0
7394 11CF7E rest1: LXI D,ABORTD
7397 CDEF01 CALL DCS; Display " COMPLETE"
739A 011700 REST2: LXI B,INITE-INITB; Initialize all variables that need it.
739D 11037F LXI D,INITV
73A0 21D97E LXI H,INITB
73A3 3EFF MVI A,11111111B
73A5 D3C1 OUT INT+1; Disable all interrupts (especially RDIS).
73A7 CDE87D CALL MOVE
73AA 3E80 MVI A,10000000B
73AC D3C1 OUT INT+1; Enable all seven interrupts.
73AE 3A057F EOF: LDA READY; End-of-film command:
73B1 21C37F LXI H,FMBSY
73B4 B6 ORA M
73B5 21C27F LXI H,LMBSY
73B8 B6 ORA M
73B9 C2AE73 JNZ EOF; Wait until READY=FMBSY=LMBSY=0.
73BC 2A477F LHLD FMP
73BF EB XCHG
73C0 2A437F LHLD YHOME; Set up to move the feed motor to home position,
73C3 CD9E7D CALL CMPD; after unclamping the film.
73C6 3E01 MVI A,1
73C8 C4BD79 CNZ NCLMP
73CB 110000 LXI D,0; Start lens motor moving to home position.
73CE CD7C77 CALL LGO0
73D1 21147F LXI H,MSLS
MICRO-SYMBOL 16-DEC-1980 ALPHA4 PAGE 7-2
73D4 3E80 MVI A,10000000B
73D6 F3 di
73D7 B6 ORA M
73D8 77 MOV M,A
73D9 FB ei
73DA D3DB OUT MSLCH; Turn audio signal on.
73DC C39B74 JMP READ; Go on to read the next instruction.
MICRO-SYMBOL 16-DEC-1980 ALPHA4 PAGE 8
; Main scanning routine, returns the next byte of input in register A:
; (Note: H and L are clobbered, but not B, C, D, or E. This subroutine
; must not be called from within another subroutine, because of the way
; it handles requests to ABORT the job.)
73DF 2A0A7F GET: LHLD DQOUT; Spot in queue from which to get character.
73E2 3A0D7F LDA QFLAG
73E5 B7 ORA A
73E6 CA0E74 JZ GET0; Jump if no transmission to the host was requested.
73E9 DB81 IN RS232+1
73EB E605 ANI 101B
73ED EE05 XRI 101B
73EF C20E74 JNZ GET0; Jump if the line is busy.
; Now the line is "doubly free": the USART will be able to send a character
; during an RS232 interrupt as well as the character we are about to send.
73F2 3A0D7F LDA QFLAG
73F5 FE0F CPI 00001111B
73F7 CA7073 JZ ABRT; Jump if abortion requested.
73FA 3A067F LDA DQIN
73FD 95 SUB L; A ← buffer space in use.
73FE FEC0 CPI 256-64
7400 D20E74 JNC GET0; Jump if there isn't room in buffer for another block.
; If rA less than 256-64, there are at least 64 usable spaces in the buffer
; (63 for data and one for the sum check byte). Buffer capacity is 255 bytes.
7403 3A0D7F QOK: LDA QFLAG; QFLAG contains the acknowledgment byte we wish to send.
7406 F3 di
7407 D380 OUT RS232
7409 97 SUB A
740A 320D7F STA QFLAG; Zero the flag once it's sent.
740D FB ei
; If an interrupt occurs between this OUT and STA, with the host asking for a
; current status report, we will transmit bit 1 = 1 instead of 0;
; but the host will understand, since it just got the acknowledgment.
740E 3A087F GET0: LDA DQACK
7411 BD CMP L
7412 CADF73 JZ GET; Wait until the DQ input buffer is nonempty.
7415 7E MOV A,M; Fetch the next byte
7416 2C INR L
7417 220A7F SHLD DQOUT; Advance the buffer pointer (wrapping mod 256).
741A C9 RET
MICRO-SYMBOL 16-DEC-1980 ALPHA4 PAGE 9
; A program that prepares to typeset a character.
741B 4F TYPST: MOV C,A; Typeset-character command:
741C 3A057F TYP1: LDA READY
741F FE02 CPI 2
7421 D21C74 JNC TYP1; Wait until READY<2.
7424 2A1F7F LHLD LBIN
7427 71 MOV M,C; Store the character in LB.
7428 69 MOV L,C
7429 2600 MVI H,0
742B 29 DAD H
742C 29 DAD H
742D 111081 LXI D,CTB-10
7430 19 DAD D; HL←CTB table address for character.
7431 5E MOV E,M
7432 23 INX H
7433 56 MOV D,M; DE←repertoire address for character.
7434 210500 LXI H,5
7437 19 DAD D; HL←address of byte 6.
7438 5E MOV E,M
7439 23 INX H
743A 7E MOV A,M
743B E607 ANI 111B
743D 57 MOV D,A; DE←horizontal multiplier.
743E D5 PUSH D
743F 21002D LXI H,360*32
7442 CDB47D CALL MULTD; HL←[360a].
7445 E5 PUSH H
7446 CDDF73 CALL GET
7449 5F MOV E,A
744A CDDF73 CALL GET
744D 57 MOV D,A; DE←desired character position in dot units.
744E CDDF73 CALL GET
7451 4F MOV C,A; C←left cog increment.
7452 CDDF73 CALL GET
7455 47 MOV B,A; B←right cog increment.
7456 3AE27F LDA STATE
7459 B7 ORA A
745A FA6074 JM TYP3; jump if LR state.
745D 79 MOV A,C; interchange left and right increments.
745E 48 MOV C,B
745F 47 MOV B,A
MICRO-SYMBOL 16-DEC-1980 ALPHA4 PAGE 9-2
7460 E1 TYP3: POP H
7461 CDA47D CALL SUBD; DE←xshift.
7464 E1 POP H; HL←xmult.
7465 7A MOV A,D
7466 E607 ANI 111B; Compute and pack the msbs of xshift and xmult.
7468 0F RRC
7469 0F RRC
746A 0F RRC
746B 0F RRC
746C B4 ORA H; Now AE = xshift (will be stored in line buffer, msb first).
746D 2A1F7F LHLD LBIN
7470 23 INX H
7471 77 MOV M,A
7472 23 INX H
7473 73 MOV M,E
7474 97 SUB A
7475 57 MOV D,A
7476 58 MOV E,B
; Now we have AC = starting cog increment, DE = ending cog increment,
; and CB = bytes to be stored.
7477 23 TYP2: INX H
7478 71 MOV M,C
7479 23 INX H
747A 70 MOV M,B
747B 47 MOV B,A
747C 23 INX H
747D 3AE27F LDA STATE
7480 B7 ORA A
7481 FA9874 JM TYP4; Jump if LR state.
7484 E5 PUSH H
7485 2A237F LHLD RLI
7488 09 DAD B
7489 22237F SHLD RLI
748C 2A257F LHLD RLJ
748F 19 DAD D
7490 22257F SHLD RLJ; Update cog accumulators for RL setting.
7493 11F6FF LXI D,-10
7496 E1 POP H
7497 19 DAD D; RL state moves right to left in LB.
7498 221F7F TYP4: SHLD LBIN; Update line buffer position.
MICRO-SYMBOL 16-DEC-1980 ALPHA4 PAGE 10
; The main scanning loop, beginning a new instruction:
; (Control "falls through" to here from the program on the previous page.)
749B CDDF73 READ: CALL GET; A←first byte.
749E FE02 CPI 2
74A0 D22E75 JNC READ1; Jump if 2 or more.
74A3 B7 ORA A
74A4 C20576 JNZ CMULT; Jump if 1.
74A7 CDDF73 CALL GET; A←second byte.
74AA FE02 CPI 2
74AC D2C874 JNC READ2; Jump if 2 or more.
74AF B7 ORA A
74B0 C21D7A JNZ BPAGE; Jump if 1.
74B3 CDDF73 CALL GET; A←third byte.
74B6 B7 ORA A
74B7 CA3B76 JZ ADJC; Jump if 0.
74BA 4F DISPM: MOV C,A; Display-message command:
74BB CDDF73 DISP1: CALL GET
74BE CDFD01 CALL DC; Display one character.
74C1 0D DCR C
74C2 C2BB74 JNZ DISP1
74C5 C39B74 JMP READ
74C8 CA857A READ2: JZ EOL; Jump if 2.
74CB 6F NEWCH: MOV L,A; New-character command:
74CC 2600 MVI H,0
74CE 29 DAD H
74CF 29 DAD H; HL←character code times 4.
74D0 110E81 LXI D,CTB-12
74D3 19 DAD D
74D4 E5 PUSH H; Save CTB table location for the new character.
74D5 CDDF73 CALL GET
74D8 5F MOV E,A
74D9 CDDF73 CALL GET
74DC 57 MOV D,A; DE←location in repertoire.
74DD CDDF73 CALL GET
74E0 4F MOV C,A
74E1 CDDF73 CALL GET
74E4 47 MOV B,A; BC←number of boundary data bytes.
74E5 E1 POP H
MICRO-SYMBOL 16-DEC-1980 ALPHA4 PAGE 10-2
74E6 C5 PUSH B; Save number of bytes.
74E7 71 MOV M,C; Store length in CTB table.
74E8 23 INX H
74E9 70 MOV M,B
74EA 23 INX H
74EB 73 MOV M,E; Store repertoire location in CTB table.
74EC 23 INX H
74ED 72 MOV M,D
74EE 97 SUB A
74EF B1 ORA C; Prepare to loop BC times.
74F0 CAF474 JZ NEW1
74F3 04 INR B
74F4 CDDF73 NEW1: CALL GET; DE=address for next byte.
74F7 12 STAX D
74F8 13 INX D
74F9 0D DCR C
74FA C2F474 JNZ NEW1
74FD 05 DCR B
74FE C2F474 JNZ NEW1
7501 97 SUB A; Now store the three final bytes.
7502 12 STAX D
7503 13 INX D
7504 12 STAX D
7505 13 INX D
7506 3EF8 MVI A,11111000B
7508 12 STAX D
7509 E1 POP H
750A CDA47D CALL SUBD; DE←address of third byte of boundary data.
750D 210300 LXI H,3
7510 19 DAD D; HL←address of byte 6.
7511 3A0F7F LDA AMULT; store horizontal multiplier.
7514 77 MOV M,A
7515 23 INX H
7516 3A107F LDA AMULT+1
7519 77 MOV M,A
751A 23 INX H
751B 3A117F LDA BMULT; store vertical multiplier.
751E 77 MOV M,A
751F 23 INX H
7520 3A137F LDA YSBM
7523 77 MOV M,A; Store msb of yshift and ymult.
MICRO-SYMBOL 16-DEC-1980 ALPHA4 PAGE 10-3
7524 23 INX H
7525 23 INX H
7526 23 INX H
7527 3A127F LDA YSHFT
752A 77 MOV M,A; Store lsb of yshift.
752B C39B74 JMP READ; Done inputting the new character, go to next instruction.
752E C21B74 READ1: JNZ TYPST; Jump if 3 or more.
7531 CDDF73 CALL GET; A←second byte.
7534 FE02 CPI 2
7536 DA6C75 JC READ3; Jump if 0 or 1.
7539 CAF375 JZ FEED; Jump if 2.
753C 6F SHUFF: MOV L,A; Shuffle command:
753D 2600 MVI H,0
753F 29 DAD H
7540 29 DAD H
7541 110E81 LXI D,CTB-12
7544 19 DAD D
7545 E5 PUSH H; Save CTB location for character to be moved.
7546 CDDF73 CALL GET
7549 5F MOV E,A
754A CDDF73 CALL GET
754D 57 MOV D,A; DE←new location.
754E E1 POP H
754F 4E MOV C,M
7550 23 INX H
7551 46 MOV B,M; BC←number of boundary bytes.
7552 03 INX B
7553 03 INX B
7554 03 INX B
7555 C5 PUSH B; Save the number of bytes to move.
7556 3A057F SHUF1: LDA READY; Wait until READY=0.
7559 B7 ORA A
755A C25675 JNZ SHUF1
755D 23 INX H; Store new location in CTB table, prior to moving,
755E 4E MOV C,M; meanwhile setting BC←old location.
755F 73 MOV M,E
7560 23 INX H
7561 46 MOV B,M
7562 72 MOV M,D
7563 69 MOV L,C
7564 60 MOV H,B
MICRO-SYMBOL 16-DEC-1980 ALPHA4 PAGE 10-4
7565 C1 POP B
7566 CDE87D CALL MOVE; Move the data.
7569 C39B74 JMP READ; Advance to next command.
756C B7 READ3: ORA A
756D C2AE73 JNZ EOF; Jump if 1.
MICRO-SYMBOL 16-DEC-1980 ALPHA4 PAGE 11
; Program to set a specified beam brightness.
; (Control "falls through" from the READ routine on the preceding page.)
7570 CDDF73 BRITE: CALL GET; Change-brightness command:
7573 5F MOV E,A
7574 CDDF73 CALL GET
7577 57 MOV D,A; DE←brightness parameter (0 to 3000).
7578 3A057F BRIT1: LDA READY
757B 21C27F LXI H,LMBSY
757E B6 ORA M
757F 21C37F LXI H,FMBSY
7582 B6 ORA M
7583 C27875 JNZ BRIT1; Wait until READY=LMBSY=FMBSY=0.
7586 D5 PUSH D
7587 21343C LXI H,3C34H; (.2351628457)
758A CDB47D CALL MULTD; Multiply by exposure correction factor, giving HL = y, say.
758D 29 DAD H
758E 29 DAD H
758F 29 DAD H
7590 29 DAD H
7591 29 DAD H
7592 7C MOV A,H; A ← [y/8] = z, say.
7593 29 DAD H; HL ← 64y.
7594 F5 PUSH PSW
7595 2F CMA
7596 5F MOV E,A
7597 16FF MVI D,-1
7599 13 INX D; DE ← -z.
759A D398 OUT BEAMR; Reset beam position.
759C 01157F LXI B,BTLS
759F 0A LDAX B
75A0 F620 ORI 20H
75A2 02 STAX B; Set lens motor moving to the right
75A3 D3DA OUT BTLCH; (so that the beam steps to the right).
75A5 010000 LXI B,0; Now comes a loop to set the brightness increments.
75A8 DBDF BRIT2: IN BSTEP; Step the beam.
75AA 03 INX B
75AB 79 MOV A,C
75AC E60F ANI 0FH
75AE C2A875 JNZ BRIT2
75B1 7C MOV A,H; Every 16 steps, store H in the brightness-increment memory.
75B2 2F CMA
75B3 D388 OUT BRT1
75B5 D3A0 OUT BRT2
MICRO-SYMBOL 16-DEC-1980 ALPHA4 PAGE 11-2
75B7 19 DAD D; HL ← HL plus or minus z.
75B8 78 MOV A,B
75B9 D620 SUI 20H
75BB C2C375 JNZ BRIT3
75BE 57 MOV D,A; Now BC = 2000H, we have stored 512 bytes.
75BF F1 POP PSW
75C0 5F MOV E,A; Set DE ← +z.
75C1 0680 MVI B,80H; This is a dirty trick, it sets BC←8000H.
75C3 FE80 BRIT3: CPI 80H
75C5 C2A875 JNZ BRIT2; Jump if we haven't stored 1024 bytes.
75C8 2A497F LHLD LMP; Now move beam back into proper position.
75CB 115BFC LXI D,-933
75CE 19 DAD D
75CF 7C MOV A,H
75D0 E63F ANI 3FH
75D2 67 MOV H,A
75D3 7D MOV A,L
75D4 B7 ORA A
75D5 CAD975 JZ BRIT4; Prepare to loop (LMP-933) mod 16192 times.
75D8 24 INR H
75D9 DBDF BRIT4: IN BSTEP
75DB 2D DCR L
75DC C2D975 JNZ BRIT4
75DF 25 DCR H
75E0 C2D975 JNZ BRIT4
75E3 E1 POP H; Set overall brightness.
75E4 11FF03 LXI D,1023
75E7 19 DAD D
75E8 7D MOV A,L
75E9 2F CMA
75EA D388 OUT BRT1
75EC 7C MOV A,H
75ED 2F CMA
75EE D390 OUT BRT1+8
75F0 C39B74 JMP READ; Go on to the next command.
MICRO-SYMBOL 16-DEC-1980 ALPHA4 PAGE 12
; Programs for simple adjustment commands.
75F3 CDDF73 FEED: CALL GET; Feed command:
75F6 5F MOV E,A
75F7 CDDF73 CALL GET
75FA 57 MOV D,A; DE←amount to feed (in feed motor units).
75FB 2A1D7F LHLD YBASE
75FE 19 DAD D
75FF 221D7F SHLD YBASE; Update current value of YBASE.
7602 C39B74 JMP READ; Go on to the next command.
7605 CDDF73 CMULT: CALL GET; Change-multipliers command:
7608 5F MOV E,A
7609 CDDF73 CALL GET
760C 57 MOV D,A
760D EB XCHG
760E 220F7F SHLD AMULT; Store new horizontal multiplier.
7611 CDDF73 CALL GET
7614 5F MOV E,A
7615 CDDF73 CALL GET
7618 57 MOV D,A
7619 F5 PUSH PSW
761A EB XCHG
761B 22117F SHLD BMULT; Store new vertical multiplier.
761E 11202E LXI D,369*32
7621 CDB47D CALL MULTD; HL←[369b].
7624 110501 LXI D,261
7627 CDA47D CALL SUBD; DE←yshift.
762A 7A MOV A,D
762B E607 ANI 00000111B
762D 0F RRC
762E 0F RRC
762F 0F RRC
7630 0F RRC ; Rotate four bits.
7631 E1 POP H
7632 B4 ORA H; Pack leading bits of yshift and the multiplier.
7633 57 MOV D,A
7634 EB XCHG
7635 22127F SHLD YSHFT
7638 C39B74 JMP READ; Go on to the next command.
763B 3A057F ADJC: LDA READY; Adjust-cogs command:
763E FE02 CPI 2
7640 D23B76 JNC ADJC; Wait until READY<2.
MICRO-SYMBOL 16-DEC-1980 ALPHA4 PAGE 12-2
7643 CDDF73 CALL GET
7646 4F MOV C,A
7647 CDDF73 CALL GET
764A 47 MOV B,A; BC←amount of adjustment.
764B 1E00 MVI E,0
764D 2A1F7F LHLD LBIN
7650 73 MOV M,E; Store three zero bytes in the line buffer.
7651 23 INX H
7652 73 MOV M,E
7653 23 INX H
7654 73 MOV M,E
7655 50 MOV D,B
7656 59 MOV E,C
7657 C37774 JMP TYP2; Go to common routine with the Typeset command.
MICRO-SYMBOL 16-DEC-1980 ALPHA4 PAGE 13
; Interrupt handling for data received from computer or operator.
; dummy rs232 transmitter ready interrupt routine
;rtis: push psw;
; push h;
; push d;
; mvi a,'z'
; call dc
; jmp pop3
765A 00 RS232B: DB 0; byte of data from RS232 port.
765B F5 RRIS: PUSH PSW;
765C E5 PUSH H
765D DB80 IN RS232
765F 325A76 STA RS232B
7662 21147F LXI H,MSLS
7665 3E01 MVI A,00000001B
7667 F3 di
7668 B6 ORA M
7669 77 MOV M,A
766A FB ei
766B D3DB OUT MSLCH; Raise RDIS interrupt
766D C36D77 JMP POP2;
0069 MAGIC EQU 01101001B; Specially flagged byte for protocol.
7670 F5 RDIS: PUSH PSW; RS232 data interrupt service:
7671 E5 PUSH H
7672 D5 PUSH D
7673 21147F LXI H,MSLS
7676 3EFE MVI A,11111110B
7678 F3 di
7679 A6 ANA M
767A 77 MOV M,A
767B FB ei
767C D3DB OUT MSLCH; Turn off RDIS condition
767E 210E7F LXI H,MFLAG; Look at protocol's magic-word flag.
7681 7E MOV A,M
7682 FE69 CPI MAGIC
7684 3A5A76 LDA RS232B; Get the new data.
7687 CAB476 JZ PRTCL; Jump if MFLAG = magic.
768A 77 MOV M,A; MFLAG gets new data byte.
768B FE69 CPI MAGIC; Not in magic mode yet, check if magic word.
768D CA6C77 JZ POP3; Wait for second byte--the magic command.
MICRO-SYMBOL 16-DEC-1980 ALPHA4 PAGE 13-2
7690 2A067F RDATA: LHLD DQIN; Just data, look at queue now.
7693 77 MOV M,A; Store new byte of data.
7694 EB XCHG ; DE←DQIN.
7695 21037F LXI H,SUMCH
7698 86 ADD M
7699 77 MOV M,A; Update the sum check.
769A EB XCHG ; HL←DQIN.
769B 2C INR L; Advance line buffer pointer (wrapping mod 256).
769C 3A0A7F LDA DQOUT
769F BD CMP L
76A0 CAA976 JZ OVRUN; Jump if buffer was already full (contained 255 bytes).
76A3 22067F SHLD DQIN
76A6 C36C77 JMP POP3; Restore registers and return from the interrupt.
76A9 1610 OVRUN: MVI D,00010000B; Set overrun flag.
76AB 210C7F BAD: LXI H,OVFLG; Input character will be dropped (DQIN not updated).
76AE 7E MOV A,M;
76AF B2 ORA D; (Either of two errors here.)
76B0 77 MOV M,A
76B1 C36C77 JMP POP3; Restore registers and return.
76B4 3600 PRTCL: MVI M,0; Reset MFLAG.
76B6 FE69 CPI MAGIC
76B8 CA9076 JZ RDATA; Just a quoted character with the magic code 69H.
76BB FE02 CPI 10B
76BD CA1277 JZ AQUIT; We just got a request to abort.
76C0 DAC876 JC ZORO; Command is 0 or 1.
76C3 1640 MVI D,01000000B; Byte > 2, but not 69H, must be sumcheck error.
76C5 C3AB76 JMP BAD; Store the error in OVFLG at BAD.
76C8 B7 ZORO: ORA A
76C9 C21A77 JNZ RPORT; Command=1, report our status.
76CC 21037F LXI H,SUMCH
76CF 7E MOV A,M; Get the sum check as of byte before 69H,0H pair.
76D0 3600 MVI M,0; Set SUMCH←0.
76D2 B7 ORA A
76D3 210C7F LXI H,OVFLG
76D6 7E MOV A,M
76D7 CADC76 JZ RDIS4; Jump if sum check was OK.
76DA F640 ORI 01000000B; Set bit indicating sum check failure.
76DC 57 RDIS4: MOV D,A; Save error bits.
MICRO-SYMBOL 16-DEC-1980 ALPHA4 PAGE 13-3
76DD 3600 MVI M,0; Clear OVFLG.
76DF 210D7F LXI H,QFLAG
76E2 7E MOV A,M
76E3 B7 ORA A
76E4 C26C77 JNZ POP3; Return without acknowledgment if abort is pending.
76E7 DB81 IN RS232+1; Read state of USART chip.
76E9 E630 ANI 00110000B
76EB B2 ORA D; Merge error flags.
76EC 57 MOV D,A
76ED 0F RRC
76EE 0F RRC
76EF 0F RRC
76F0 0F RRC
76F1 B2 ORA D
76F2 EEF0 XRI 11110000B
76F4 320D7F STA QFLAG; Set QFLAG to acknowledgment byte with error flags.
76F7 E607 ANI 111B
76F9 21067F LXI H,DQIN
76FC C20777 JNZ RDIS6; Jump if there was an error.
76FF 35 DCR M; Decrease DQIN (i.e., drop the sum check byte).
7700 7E MOV A,M
7701 32087F STA DQACK; Set DQACK←DQIN (i.e., accept the last block).
7704 C36C77 JMP POP3; Return from interrupt.
7707 3E37 RDIS6: MVI A,00110111B;
7709 D381 OUT RS232+1; Reset error flags in USART chip.
770B 3A087F LDA DQACK
770E 77 MOV M,A; Set DQIN←DQACK (i.e., reject the last block).
770F C36C77 JMP POP3; Return from interrupt.
7712 3E0F AQUIT: MVI A,00001111B
7714 320D7F STA QFLAG; Set flag so we will know to abort.
7717 C36C77 JMP POP3
771A 165A RPORT: MVI D,01011010B; Set rD ← status report with ack pending.
771C 3A0D7F LDA QFLAG; Negative QFLAG means we'll acknowledge shortly.
771F B7 ORA A
7720 FA2877 JM RPRT0
7723 C23277 JNZ RPRT1; Positive nonzero QFLAG is ABORT code, send one now.
7726 1678 MVI D,01111000B; Set rD ← status report with ack not pending.
7728 3A147F RPRT0: LDA MSLS
772B B7 ORA A
772C 7A MOV A,D; Copy report byte from D.
MICRO-SYMBOL 16-DEC-1980 ALPHA4 PAGE 13-4
772D F23277 JP RPRT1; The sign of MSLS is set if waiting for film-change.
7730 EE11 XRI 00010001B
7732 D380 RPRT1: OUT RS232; Send the status report and continue on.
7734 C36C77 JMP POP3
7737 F5 KBIS1: PUSH PSW; Keyboard interrupt service when on-line:
7738 E5 PUSH H
7739 DBDD IN DISPL
773B E60F ANI 0FH; Read keyboard code.
773D 21047F LXI H,KBIB1
7740 FE09 CPI 9
7742 C25077 JNZ KBIS2; Jump if not "0".
7745 7E MOV A,M
7746 FE05 CPI 5
7748 C25077 JNZ KBIS2; Jump if previous was not "3".
774B 3E0F MVI A,00001111B
774D 320D7F STA QFLAG; Prepare to abort when scanning resumes.
; `CALL DEBUG' or `JMP QUIT' could be substituted for `STA QFLAG' when debugging.
7750 77 KBIS2: MOV M,A; Store the code in KBIB1.
7751 FE03 CPI 3
7753 C26177 JNZ KBIS3; Jump if not "5".
7756 21147F LXI H,MSLS
7759 3E7F MVI A,01111111B
775B F3 di
775C A6 ANA M
775D 77 MOV M,A
775E FB ei
775F D3DB OUT MSLCH; Turn audio signal off.
7761 C36D77 KBIS3: JMP POP2; Restore registers and return from the interrupt.
MICRO-SYMBOL 16-DEC-1980 ALPHA4 PAGE 14
; Lens motor control routines:
7764 F5 LMIS: PUSH PSW; Lens motor interrupt service:
7765 E5 PUSH H
7766 D5 PUSH D
7767 C5 PUSH B
7768 CDD777 CALL LCYC; Do one lens cycle.
776B C1 POP4: POP B; Return from interrupt, restoring all four register pairs.
776C D1 POP3: POP D
776D E1 POP2: POP H
776E 3E20 MVI A,20H
7770 F3 DI
7771 D3C0 OUT INT; Remove current bit from interrupt status register.
7773 DBC0 IN INT; A ← bits for other interrupts in service, if any.
7775 B7 ORA A
7776 CA7977 ISW: JZ ISW0; This address is modified if low-priority routine scheduled.
; Note that low-priority routines must not be entered when an interrupt was
; interrupted, since the interrupt service register in the 8259 chip must
; record the true "fully nested" state of what interrupts are being serviced.
7779 F1 ISW0: POP PSW
777A FB EI
777B C9 RET ; Return from interrupt.
; The following subroutine begins a chain of events that will move the lens
; motor to position DE, including all necessary acceleration and deceleration.
; If A=0, the typesetting of a line will also be initiated at the proper time.
777C 3E01 LGO0: MVI A,1; Special case of LGO when not typesetting.
777E 324B7F LGO: STA LTYPE
7781 2A497F LHLD LMP; HL←lens motor current position (in motor steps from home).
7784 CD9E7D CALL CMPD
7787 C8 RZ ; Return if already there.
7788 EB XCHG
7789 22497F SHLD LMP; Store the position to be moved to.
778C 01157F LXI B,BTLS
778F 0A LDAX B
7790 DA9977 JC LGO1; Jump if movement will be towards the left (LMP decreasing).
7793 F620 ORI 00100000B; Set lens motor direction = right.
7795 EB XCHG ; Interchange so that HL≤DE.
7796 C39B77 JMP LGO2
7799 E6DF LGO1: ANI 11011111B; Set lens motor direction = left.
779B 02 LGO2: STAX B
779C D3DA OUT BTLCH
MICRO-SYMBOL 16-DEC-1980 ALPHA4 PAGE 14-2
779E CDA47D CALL SUBD; DE←number of motor steps needed, say n.
77A1 D5 PUSH D
77A2 1B DCX D
77A3 1B DCX D
77A4 7B MOV A,E
77A5 E6FC ANI 11111100B; Truncate n-2 to a multiple of 4.
77A7 5F MOV E,A
77A8 215001 LXI H,84*4
77AB CD9E7D CALL CMPD
77AE D2B277 JNC LGO3; Jump if (n-2)/4≥84.
77B1 EB XCHG
77B2 D1 LGO3: POP D; Now HL is 4 times the number of acceleration cycles (≤4*84).
77B3 CDA47D CALL SUBD; Set DE ← n-HL = number of steps at top speed (≥2).
77B6 EB XCHG
77B7 22527F SHLD LSTEP
77BA 7A MOV A,D
77BB 0F RRC
77BC 7B MOV A,E
77BD 1F RAR
77BE 5F MOV E,A; Set E ← twice the number of acceleration cycles (mod 256).
77BF 211B7E LXI H,TABLE
77C2 22507F SHLD LRATE; Initialize the rate pointer.
77C5 19 DAD D
77C6 2600 MVI H,0
77C8 224E7F SHLD LLIM; Set LLIM←lsb of top-speed rate address, and set LSTAT←0.
77CB CDFB7D CALL DELAY2; Make sure lens motor is resting.
77CE CDD777 CALL LCYC; Do the first lens motor cycle.
77D1 3E01 MVI A,1
77D3 32C27F STA LMBSY; Mark lens motor busy.
77D6 C9 RET ; Return from the subroutine.
; LSTAT=0 when accelerating, =1 at top speed, >1 when decelerating.
77D7 3A4F7F LCYC: LDA LSTAT; Subroutine to do one lens motor cycle:
77DA B7 ORA A
77DB C23178 JNZ LCYC1; Jump if not accelerating.
77DE 3A4E7F LDA LLIM
77E1 2A507F LHLD LRATE
77E4 BD CMP L; (least significant bytes suffice for comparison)
77E5 5E MOV E,M
MICRO-SYMBOL 16-DEC-1980 ALPHA4 PAGE 14-3
77E6 23 INX H
77E7 56 MOV D,M; DE ← current rate from table.
77E8 CA0E78 JZ LCYC2; Jump if maximum rate achieved.
77EB 23 INX H
77EC 22507F LCYC3: SHLD LRATE; Update location of next rate.
77EF 210100 LXI H,1; Take two steps.
77F2 3E70 LCYCS: MVI A,70H
77F4 D3CB OUT LTIMR+3; Prepare for lens motor interrupt,
77F6 7D MOV A,L
77F7 D3C9 OUT LTIMR+1
77F9 7C MOV A,H
77FA D3C9 OUT LTIMR+1; after HL+1 steps.
77FC 3AC27F LDA LMBSY
77FF B7 ORA A
7800 C20778 JNZ LCYC4; Jump if not the first cycle.
7803 3E34 MVI A,34H
7805 D3CB OUT LTIMR+3; Stop the rate counter until it is loaded.
7807 7B LCYC4: MOV A,E
7808 D3C8 OUT LTIMR
780A 7A MOV A,D
780B D3C8 OUT LTIMR; Load rate DE.
78